# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

Product.delete_all

module UrlFactory
  CATS_LIST = %w{
    http://www.bubblews.com/assets/images/news/1771886411_1372179047.jpg
    http://jazzedaboutstuff.files.wordpress.com/2012/01/the-obsession-with-cats.jpg
    http://pussingtonpost.com/wp-content/uploads/2012/06/June_odd-eyed-cat2.jpg
    http://lolomoda.com/wp-content/uploads/30192_1600x1200-4-cute-cats.jpg
    http://beautifulcoolwallpapers.files.wordpress.com/2011/06/so-freakin-cute-cats-248645_1024_768.jpg
    https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRykV7xzYhVePRTqYusaFz9D5rQIp_nJM2B5WNOQseDgmDjmpUy
    https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSQkcRdHhIMDhrqFW8kpxKhYAUoBjT4oyJcrxib-97BOTzYL9rcAg
    http://www.pageresource.com/wallpapers/wallpaper/cats-beautiful-free_323128.jpg
    http://www.catster.com/files/why-paint-cats-skeleton.jpg
    http://rack.3.mshcdn.com/media/ZgkyMDEzLzAyLzI1LzdmL3NrcmlsbGV4Y2F0LmRiMTM3LmdpZgpwCXRodW1iCTg1MHg1OTA-CmUJanBn/cd6f7d62/272/skrillex-cat.jpg
    http://cs322228.vk.me/v322228937/501b/it1p-CimmJY.jpg
  }
  def UrlFactory.Get_url 
    #puts cats_list
    return CATS_LIST[rand(CATS_LIST.length-1)]
  end
    
end

100.times do |num| Product.create(title: 'Coding ruby 2.0' +': #' +  num.to_s(), description:
      %{<p>
        ruby is a fastiest growing and most exiting dynamic language} + ': #' + num.to_s(),
        image_url: UrlFactory.Get_url(),
        price: 49.00 + num * rand(10)/10 
        )
end

        
        
        
